package com.example.sugar.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ViewStateMapper {

    @Select("select \n" +
            " sum(video_view) video_view,\n" +
            " from dws_view_count \n" +
            "WHERE toYYYYMMDD(stt) = #{date} \n" +
            "group by chapter_id")
    List<Integer> selectAnswer(@Param("date") Integer date);


    @Select("select \n" +
            " sum(user_sum) user_sum,\n" +
            " from dws_view_count \n" +
            "WHERE toYYYYMMDD(stt) = #{date} \n" +
            "group by chapter_id")
    List<Integer> selectAnswer1(@Param("date") Integer date);

    @Select("select \n" +
            " sum(video_view)/sum(user_sum) user_sum,\n" +
            " from dws_view_count \n" +
            "WHERE toYYYYMMDD(stt) = #{date} \n" +
            "group by chapter_id")
    List<Integer> selectAnswer2(@Param("date") Integer date);

}
